extern crate rand;
use std::env::{self};


mod setup;
mod rotor;
mod gen;
mod logic;

fn main() {
    
    let config_dir = setup::config_dir();
    setup::check_files(config_dir.clone());
    let dailies = logic::Dailies::new(setup::load_dailies(config_dir.clone()));
    let mut enigma = logic::Enigma::new(setup::load_rotors(config_dir.clone()), dailies);

    let args:Vec<String> = env::args().collect();
    if args.len() > 1 {
        let input:String = args[1].clone();
        println!("");
        let message: Vec<char> = logic::filter_chars(input.chars().collect());
        for c in message {
            let x = enigma.encrypt(c);
                print!("{}",x);
        }
        println!("");
    }
}

